import { TOKEN_KEY, USER_INFO } from '@/constants';
import { getLocalStorage, setLocalStorage } from './index';

/**
 * 清除token
 */
export function removeToken() {
  localStorage.removeItem(TOKEN_KEY);
}
/**
 * 设置token
 */
export function setToken(token: string) {
  setLocalStorage(TOKEN_KEY, token);
}
/**
 * 获取token
 */
export function getToken() {
  return getLocalStorage(TOKEN_KEY);
}
/**
 * 设置用户信息
 */
export function setUserInfoLocal(info: any) {

  return setLocalStorage(USER_INFO, info);
}

/**
 * 获取用户信息
 */
export function getUerInfo(): API.UserInfo {
  return getLocalStorage(USER_INFO);
}


/**
 * 
 */
export function isMeById(id:string) {
  return id === getUerInfo()?.id;
}